package com.springboot.demo.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

/**
 * 项目配置文件
 *
 * @author supu
 * @date 2019-08-09 9:29
 **/
@Configuration
public class DemoConfig {
    @Autowired
    private Environment environment;
    /**
     * zookeeper 配置
     */
    public static final String ZOOKEEPER_ADDRESS = "zookeeper.address";
    public static final String ZOOKEEPER_GROUP = "zookeeper.group";
    public static final String ZOOKEEPER_SESSION_TIMEOUT = "zookeeper.session.timeout";
    public static final String ZOOKEEPER_CONNECTION_TIMEOUT = "zookeeper.connection.timeout";
    public static final String ZOOKEEPER_MAX_RETRY_COUNT = "zookeeper.max.retry.count";
    public static final String ZOOKEEPER_CLIENT_SLEEP = "zookeeper.client.sleep";


    public String getString(String key){
        return environment.getProperty(key);
    }
}
